package cn.maihe.elg.operation.config;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

/**
 * @Description 线程池配置
 * @Author ssx
 * @Date 2025/05/09
 */
@Configuration
@ConfigurationProperties(prefix = "cn.maihe.elg.operation.executor")
@Getter
@Setter
public class ExecutorConfig {

    private GeneralHandleExecutorConfig general;
    private InvoiceDownLoadHandleExecutorConfig invoiceDownLoad;
    private ResultNoticeHandleExecutorConfig resultNotice;
    private GuaranteeRestoreHandleExecutorConfig guaranteeRestore;

    @Getter
    @Setter
    public static class GeneralHandleExecutorConfig {
        /**
         * 核心线程
         */
        private int corePoolSize = 4;

        /**
         * 最大线程
         */
        private int maxPoolSize = 8;

        /**
         * 空闲线程保存秒数
         */
        private int keepAliveSeconds = 60;

        /**
         * 线程队列允许等待请求数
         */
        private int queueCapacity = 200;

        /**
         * 线程名称前缀
         */
        private String threadNamePrefix="general";
    }

    @Getter
    @Setter
    public static class InvoiceDownLoadHandleExecutorConfig {
        /**
         * 核心线程
         */
        private int corePoolSize = 4;

        /**
         * 最大线程
         */
        private int maxPoolSize = 8;

        /**
         * 空闲线程保存秒数
         */
        private int keepAliveSeconds = 60;

        /**
         * 线程队列允许等待请求数
         */
        private int queueCapacity = 200;

        /**
         * 线程名称前缀
         */
        private String threadNamePrefix="invoiceDownload";
    }

    @Getter
    @Setter
    public static class ResultNoticeHandleExecutorConfig {
        /**
         * 核心线程
         */
        private int corePoolSize;

        /**
         * 最大线程
         */
        private int maxPoolSize;

        /**
         * 空闲线程保存秒数
         */
        private int keepAliveSeconds = 60;

        /**
         * 线程队列允许等待请求数
         */
        private int queueCapacity = 100;

        /**
         * 线程名称前缀
         */
        private String threadNamePrefix="resultNotice";
    }

    @Getter
    @Setter
    public static class GuaranteeRestoreHandleExecutorConfig {
        /**
         * 核心线程
         */
        private int corePoolSize;

        /**
         * 最大线程
         */
        private int maxPoolSize;

        /**
         * 空闲线程保存秒数
         */
        private int keepAliveSeconds = 60;

        /**
         * 线程队列允许等待请求数
         */
        private int queueCapacity = 100;

        /**
         * 线程名称前缀
         */
        private String threadNamePrefix="guaranteeRestore";
    }
}
